package com.wgo.bpot.domain.common.impl;

import java.util.Date;

import com.wgo.bpot.domain.common.CommandHistory;


public class CommandHistoryImpl extends BpotPersistableImpl implements CommandHistory {
	
	private int order;
	private Date date;
	private String userName;
	private String conceptClass;
	private String conceptName;
	private Long conceptDbId;
	private String method;
	private String argumentClass;
	private Long argumentDbId;
	private String argument;
	
	public Date getDate() {
		return date;
	}
	
	public void setDate(Date date) {
		this.date = date;
	}
	
	public String getArgument() {
		return argument;
	}

	public void setArgument(String argument) {
		this.argument = argument;
	}

	public String getArgumentClass() {
		return argumentClass;
	}

	public void setArgumentClass(String argumentClass) {
		this.argumentClass = argumentClass;
	}

	public String getConceptClass() {
		return conceptClass;
	}

	public void setConceptClass(String conceptClass) {
		this.conceptClass = conceptClass;
	}

	public Long getConceptDbId() {
		return conceptDbId;
	}

	public void setConceptDbId(Long conceptDbId) {
		this.conceptDbId = conceptDbId;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	public Long getArgumentDbId() {
		return argumentDbId;
	}

	public void setArgumentDbId(Long argumentDbId) {
		this.argumentDbId = argumentDbId;
	}

	public String getConceptName() {
		return conceptName;
	}

	public void setConceptName(String conceptName) {
		this.conceptName = conceptName;
	}
	

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}
	
	/**
	 * Needed to trigger CGLib proxy (ie. if other CGLib-proxies is used as 
	 * parameter.)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(date.toString() + "  " + conceptName + "  " + method + "  " + argument);
		return sb.toString();
	}

	public int compareTo(CommandHistory other) {
		int typeComparison = conceptName.compareTo(other.getConceptName());
		if (0 != typeComparison) {
			return typeComparison;
		}
		int dateComparison = date.compareTo(other.getDate());
		if (0 != dateComparison) {
			return dateComparison;
		}
		return new Integer(order).compareTo(other.getOrder());
	}

}
